home *** CD-ROM | disk | FTP | other *** search
- tempowner := tempclass.create(application);
- with tempowner do begin
- try
- session.dropConnections;
- table1 := ttable.create(tempowner);
- Table1.DatabaseName:= DDAliasName;
- Table1.TableType := ttDbase;
- Table1.TableName:= DDTableName;
- Table1.Active:= True;
- dataSource1 := tdatasource.create(tempowner);
- DataSource1.DataSet:= Table1;
- query1 := tquery.create(tempowner);
- query1.databasename := DDAliasName;
- query1.datasource := DataSource1;
- query1.close;
- query1.sql.clear;
- query1.params.clear;
- sqlstr := 'SELECT * FROM '+DDTableName;
- query1.sql.add(sqlstr);
- query1.prepare;
- query1.open;
- query1.first;
- { get tablenames in data dictionary, stick in tables stringlist}
- if query1.findfield('TABLE_NAME') = nil
- then begin
- cursor := crDefault;
- MessageDlg('Not a Data Dictionary Database.', mtInformation, [mbOK], 0);
- m_status.hide;
- tempowner.free;
- {I presume the above closes database1 and query1?}
- result := ExistButNotDD;
- exit;
- end;
- m_tableList.lines.add(query1.findfield('TABLE_NAME').text); {get first one}
- inc(numfields);
- query1.next;
- while not query1.eof do begin
- tablefound := false;
- thistable := query1.findfield('TABLE_NAME').text;
- inc(numFields);
- for tablenum := 0 to m_tablelist.lines.count - 1 do
- if m_tableList.lines[tablenum] = thistable
- then begin
- tablefound := true;
- break;
- end;
- {done looking for thistable}
- if not tablefound
- then m_tablelist.lines.add(thistable);
- query1.next;
- end; {while searching for table names}
- except
- on EdataBaseError do begin
- cursor := crDefault;
- MessageDlg('Not a data base file or other DB error', mtInformation, [mbOK], 0);
- l_size.caption := '';
- l_update.caption := '';
- m_status.hide;
- result := ExistbutnotDD;
- end;
- end; {with tempowner}
- l_numtables.caption := intToSTr(m_tablelist.lines.count);
- l_numfields.caption := IntToStr(numfields);
- groupbox2.caption := 'Stats on '+DDtablename;
- query1.close;
- database1.close;
- tempowner.free;
- end;
-